package com.example.xademo.service;

import com.example.xademo.db134.dao.XA134Mapper;
import com.example.xademo.db134.model.XA134;
import com.example.xademo.db135.dao.XA135Mapper;
import com.example.xademo.db135.model.XA135;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


/**
 * @author 顾志杰
 * @date 2021/5/10-9:34
 */
@Service
public class XAService {


    @Resource
    private XA134Mapper xa134Mapper;
    @Resource
    private XA135Mapper xa135Mapper;

    @Transactional(transactionManager = "xaTransaction")
    public void testXA(){

        XA134 xa134 = new XA134();
        xa134.setId(2);
        xa134.setName("134");
        xa134Mapper.insert(xa134);

        XA135 xa135 = new XA135();
        xa135.setId(1);
        xa135.setName("135");
        xa135Mapper.insert(xa135);
    }
}
